import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)



const routes = [
  {
    path: "/login",
    component: () => import("../pages/login/login.vue"),
    meta: {
      title: "登录",
      back: true,
      register: true
    }
  },
  {
    path: "/register",
    component: () => import("../pages/register/register.vue"),
    meta: {
      title: "注册",
    }
  },
  {
    path: "/index",
    component: () => import("../pages/index/index.vue"),
    //二级路由
    children: [
      {
        path: "home", component: () => import("../pages/home/home.vue"), meta: {
          title: "首页",
          name: "首页",
        }
      },
      {
        path: "shop", component: () => import("../pages/shop/shop.vue"), meta: {
          title: "购物车",
          name: "购物车",
        }
      },
      {
        path: "classify", component: () => import("../pages/classify/classify.vue"), meta: {
          title: "分类",
          name: "分类",
          back: true
        }
      },
      {
        path: "mine", component: () => import("../pages/mine/mine.vue"), meta: {
          title: "我的",
          name: "我的",
          back: true
        }
      },
    ]


  },
  {
    path: "/search",
    component: () => import("../pages/search/search.vue"),
    meta: {
      title: "搜索", back: true
    }
  },
  {
    path: "/list",
    name: "商品列表",
    component: () => import("../pages/list/list.vue"),
    meta: {
      title: "商品列表",
      back: true
    }
  },
  {
    path: "/detaial/:id",
    component: () => import("../pages/detaial/detaial.vue"),
    name: "商品详情",
    meta: {
      title: "商品详情",
      back: true
    }
  },

  {
    path: "/order",
    component: () => import("../pages/order/order.vue"),
    meta: {
      title: "确认订单",
      back: true
    }
  },
  {
    path: "/pay",
    component: () => import("../pages/pay/pay.vue"),
    meta: {
      title: "订单支付",
      back: true
    }
  },
  {
    path: "/a-list",
    component: () => import("../pages/address_list/list.vue"),
    meta: {
      title: "地址管理",
      back: true
    }
  }, {
    path: "/a-add",
    component: () => import("../pages/address_add/add.vue"),
    meta: {
      title: "地址编辑",
      back: true
    }
  },






  {
    path: "*",
    redirect: "/login"
  }
]

const router = new VueRouter({
  routes
})

export default router
